package jschool.tracker;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;


public class Tracker {
	private final ConcurrentMap<String, Point> map;
	private final Map<String, Point> unmodifiableMap;
	
	public Tracker(Map<String, Point> map) {
		this.map = new ConcurrentHashMap<>(map);
		unmodifiableMap = Collections.unmodifiableMap(this.map);
	}
	
	public Point getLocation(String id) {
		return map.get(id);
	}
	
	public Map<String, Point> getLocations() {
		return unmodifiableMap;
	}
	
	public void setLocation(String id, Point p) {
		map.put(id, p);
	}
	
}
